﻿using DAL;
using Model;

namespace BLL
{
    public class MessageBLL
    {
        public MessageBLL (MessageDAL messageDAL)
        {
            MessageDAL = messageDAL;
        }
        public MessageDAL MessageDAL { get; }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public int Add(Message message)
        {
            try
            {
                
                return MessageDAL.Add(message);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int Delete(int id)
        {
            try
            {
                
                return MessageDAL.Delete(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="message"></param>
        /// <returns></returns>
        public int Update(Message message)
        {
            try
            {
                
                return MessageDAL.Update(message);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 反添
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Message GetMessage(int id)
        {
            try
            {
                return MessageDAL.GetMessage(id);
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 显示
        /// </summary>
        /// <returns></returns>
        public List<Message> GetAll()
        {
            try
            {
                return MessageDAL.GetAll();
            }
            catch (Exception)
            {

                throw;
            }
        }
        /// <summary>
        /// 分页
        /// </summary>
        /// <param name="name"></param>
        /// <param name="Count"></param>
        /// <param name="Sum"></param>
        /// <param name="Index"></param>
        /// <param name="Size"></param>
        /// <returns></returns>
        public List<Message> GetShow(string? name, out int Count, out int Sum, int Index = 1, int Size = 2)
        {
            try
            {
                
                return MessageDAL.GetShow(name, out Count, out Sum, Index, Size);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}
